<template>
	<view class="content">
		<block v-if="code==0">
			<view class="status_content">
				<image src="../../static/images/fail.png" mode=""></image>
				<view class="point_out">优惠券验证失败</view>
				<view class="cause">失败原因：优惠券或已使用，请核实</view>
				<view class="flex_layout status_btn">
					<button class="status_btn1"  @click="gohome">返回门店</button>
					<button class="status_btn2"  @click="qrcode">重新验证</button>
				</view>
			</view>
		</block>
		<block v-if="code==1">
			<view class="status_content">
				<image src="../../static/images/success.png" mode=""></image>
				<view class="point_out">优惠券验证成功</view>
				<!-- <view class="cause">失败原因：优惠券或已使用，请核实</view> -->
				<view class="flex_layout status_btn">
					<button class="status_btn1" @click="gohome">返回门店</button>
					<!-- <button class="status_btn2" @click="detail">查看预约</button> -->
				</view>
			</view>
		</block>
		
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				code:1
			}
		},
		onLoad(option) {
			this.code=option.code;
		},
		mounted() {
			_this= this;
		},
		onShow() {
			
		},
		methods: {
			gohome:function(){
				uni.navigateTo({
					url:'user'
				})
			},
			detail:function(){
				uni.navigateTo({
					url:'../index/detail?id='
				})
			},
			qrcode: function(){
				var that=this;
				uni.scanCode({
				    success: function (res) {
							var path='/'+res.path
							uni.navigateTo({
								url:path,
								success(res) {
									console.log(res);
								}
							})
				    }
				});
			},
		}
	}	
</script>


<style>
	page{background: #f8f8f8;}
	view,text{display: block; line-height: 1;}
	.content{padding: 50upx 30upx;}
	.flex_layout{display: flex; align-items: center; flex-wrap: wrap;}
	.status_content{background: #fff; border-radius: 10px; padding: 50upx 0;}
	.status_content image{width: 200upx; height: 200upx; display: block; margin: 0 auto;}
	.point_out{color: #333; font-size: 36upx; text-align: center; margin-top: 90upx;}
	.cause{color: #999; font-size: 30upx; text-align: center; margin-top: 20upx;}
	.status_btn{justify-content:center; margin: 50upx auto 0;}
	.status_btn button{width: 180upx; height: 55upx; line-height: 55upx; margin: 0; padding: 0; font-size: 24upx; border-radius: 55upx;}
	.status_btn button.status_btn1{background: #2562a1; color: #fff; margin: 0 30upx;}
	.status_btn button.status_btn2{background: #fff; color: #2562a1; border: 1px solid #2562a1; margin: 0 30upx;}
</style>
